<%--
  Created by IntelliJ IDEA.
  User: congqing
  Date: 2022/5/9
  Time: 21:55
  To change this template use File | Settings | File Templates.
--%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ajaxlist传值</title>
    <script type="text/javascript" src="https://code.jquery.com/jquery-3.4.1.js"></script>
    <script type="text/javascript">
        $(function () {
            // 绑定事件
            $("#btnAjax").on("click", function () {
                // alert("button click");
                $.ajax(
                    {
                        url: "../listRR.ajax",
                        data: {
                            name: "向涵之小可爱",
                            age: 18
                        },
                        dataType: "json",
                        success: function (resp) {
                            // alert("姓名：" + a.name + ", 年龄：" + a.age);
                            $.each(resp,function (i,n){
                                alert("姓名:"+n.name+"，年龄："+n.age);
                            })
                        }


                    }
                )
            })
        })
    </script>
</head>
<body>
<form method="get" action="ajaxReturnResult.ajax">
    姓名：<input name="name" type="text"><br>
    年龄：<input name="age" type="text"><br>
    <input type="submit" value="提交">
</form>
<button id="btnAjax"> ajax提交参数</button>
</body>
</html>
